I have an asp.net webforms appication in it I have an HTML table which is getting populated via ajax call sourced by a service, I want to convert the table into jQuery DataTable and source the data to the datatable but couldn't get it done and over click it is throwing 2 errors in alert (1) is "DataTables warning: table id=tblnotificationlogHistory - Ajax error. For more information about this error, please see http://datatables.net/tn/7" and (2) is "DataTables warning: table id=tblnotificationlogHistory - Cannot reinitialise DataTable. For more information about this error, please see http://datatables.net/tn/3".
Code:
``` jQuery(".statusname, .commentsHistory").click(function (event) {
debugger;
var callForCommHistory = (jQuery(this).attr("class") == 'commentsHistory');
var ccrsflattenId = jQuery(this).next('._ccrsflattenId').text();
var FlattenExtID = jQuery(this).next('._ccrsflattenId').next('._FlattenExtID').text();
var webMethod = '/Service/CRService.asmx/GetUnmatchedHistoryStatuses'
var parameters = "{ccrsflattenId: " + ccrsflattenId + " , FlattenExtID: " + FlattenExtID + " , isCallForCommHistory: " + callForCommHistory + "}";
console.log('parameters: ' + parameters);
showLoader();
jQuery.noConflict();
jQuery(".tblnotificationlogHistory").DataTable({
paging: false,
searching: false,
info: false,
processing: true,
serverside: true,
"ajax": {
"type": "POST",
"url": "webMethod",
"data": "parameters",
"contentType": "application/json; charset=utf-8",
"dataType" : "json"
},
"columns": [
{ "data": "createdDate" },
{ "data": "comments" },
{ "data": "updatedby" }
]
});
});
|